//
//  JHSUserinfoModel.m
//  JHSSweep
//
//  Created by 卢春晖 on 2017/3/25.
//  Copyright © 2017年 JHDS. All rights reserved.
//

#import "JHSUserinfoModel.h"

@implementation JHSUserinfoModel
-(void) setValue:(id)value forUndefinedKey:(NSString *)key {
    NSLog(@"出错了：value=%@  key=%@",value,key);
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

+ (instancetype)momentWithDict:(NSDictionary *)dict {
    return [[self alloc] initWithDict:dict];
}

- (NSString *)description
{
    return [self yy_modelDescription];
}

-(void)setModel:(JHSUserinfoModel *)model{
    _model = model;
//    
//    _true_name = model.true_name;
//    _age = model.age;
//    _height = model.height;
//    _weight = model.weight;
//    _address = model.address;
//    _mobile_number = model.mobile_number;
//    _card_number = model.card_number;
//    _gender = model.gender;
}

-(void)setUserDic:(NSDictionary *)userDic{
    _userDic = userDic;
    
    _user_id = userDic[@"user_id"];
    _easymob_password = userDic[@"easymob_password"];
    _true_name = userDic[@"true_name"];
    _age = [userDic[@"age"] integerValue];
    _height =  [userDic[@"height"] integerValue];
    _weight = [userDic[@"weight"] integerValue];
    _address = userDic[@"address"];
    _mobile_number = userDic[@"mobile_number"];
    _card_number = userDic[@"card_number"];
    _gender = [userDic[@"gender"] integerValue];
}
//MARK:归档
- (void)encodeWithCoder:(NSCoder *)aCoder{
    //必须把你要写入的数据说明清楚
    [aCoder encodeObject:_true_name forKey:@"true_name"];
    [aCoder encodeInteger:_age forKey:@"age"];
    [aCoder encodeFloat:_height forKey:@"height"];
    [aCoder encodeFloat:_weight forKey:@"weight"];
    [aCoder encodeObject:_address forKey:@"address"];
    [aCoder encodeFloat:_gender forKey:@"gender"];
    [aCoder encodeObject:_mobile_number forKey:@"mobile_number"];
    [aCoder encodeObject:_card_number forKey:@"card_number"];
    [aCoder encodeObject:_card_number forKey:@"user_id"];
    [aCoder encodeObject:_card_number forKey:@"easymob_password"];
    
}

//MARK:解档
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder{
    
    self = [super init];
    
    if (self) {
        //姓名
        _true_name = [aDecoder decodeObjectForKey:@"true_name"];
        //年龄
        _age = [aDecoder decodeIntegerForKey:@"age"];
        //性别
        _gender = [aDecoder decodeIntegerForKey:@"gender"];
        //身高
        _height = [aDecoder decodeFloatForKey:@"height"];
        //体重
        _weight = [aDecoder decodeFloatForKey:@"weight"];
        //籍贯
        _address = [aDecoder decodeObjectForKey:@"address"];
        //联系方式
        _mobile_number = [aDecoder decodeObjectForKey:@"mobile_number"];
        //证件号码
       _card_number = [aDecoder decodeObjectForKey:@"card_number"];
        _user_id = [aDecoder decodeObjectForKey:@"user_id"];
        _easymob_password = [aDecoder decodeObjectForKey:@"easymob_password"];
    }
    
    return self;
}

@end
